#! /bin/bash

work_dir=$(cd "$(dirname "$0")";pwd)

cd ${work_dir}

interface_dir=$(ls | grep interface)
interface_version=${interface_dir#interface}
output_dir="${work_dir}/output/ut_report/adr_ut"

mkdir -p ${output_dir}
cd ${output_dir} && rm -rf *

cd ${work_dir}/unit_test
bash ./build_ut.sh 0 ${interface_version}

./ut_mybuild/adr_test_ >> ${output_dir}/adr_ut_result.txt --gtest_output=xml:${output_dir}/

COMPILE_DIR=${work_dir}/unit_test/ut_mybuild
COVERAGE_FILE=coverage.info
REPORT_FOLDER=${output_dir}
lcov -c -d ${COMPILE_DIR} -o ${COVERAGE_FILE} --rc lcov_branch_coverage=1
lcov --remove ${COVERAGE_FILE} '*/usr/*' '*/opt/*' --output-file ${COVERAGE_FILE} --rc lcov_branch_coverage=1 -q
genhtml -o ${REPORT_FOLDER} ${COVERAGE_FILE} --rc genhtml_branch_coverage=1

